using System.Collections.Generic;
using UnityEngine;
using Verse;
using RimWorld;
using Verse.Sound;
using UnityEngine.AI;

namespace RimZombieGirl
{
    public class CompAbilityEffect_UseSatiety : CompAbilityEffect {

        private new CompProperties_UseSatiety Props => (CompProperties_UseSatiety)props;
        
        public override bool GizmoDisabled(out string reason)
        {
            if (this.parent.pawn.HasEnoughSatiety(this.Props.satietyCost))
            {
                reason = null;
                return false;
            }

            return base.GizmoDisabled(out reason);
        }

        public override bool AICanTargetNow(LocalTargetInfo target)
        {

            if (!this.parent.pawn.HasEnoughSatiety(this.Props.satietyCost))
            {
                return false;
            }

            return true;
        }

        public override void Apply(LocalTargetInfo target, LocalTargetInfo dest)
        {
            base.Apply(target, dest);

            if (this.parent.pawn.HasEnoughSatiety(this.Props.satietyCost))
            {
                this.parent.pawn.needs.food.CurLevel -= this.Props.satietyCost;
            }
        }
    }
}